/*
 * MIT License
 *
 * Copyright (C) 2023 Huawei Device Co., Ltd.
 *
 * Permission is hereby granted, free of charge, to any person obtaining a copy
 * of this software and associated documentation files (the "Software"), to deal
 * in the Software without restriction, including without limitation the rights
 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
 * copies of the Software, and to permit persons to whom the Software is
 * furnished to do so, subject to the following conditions:
 *
 * The above copyright notice and this permission notice shall be included in all
 * copies or substantial portions of the Software.
 *
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
 * SOFTWARE.
 */

import { l2 } from "../i/q";
import { g13 } from "./cache/a2";
import { p11 } from "./t1/x1";
import { f14 } from "./e2/f2";
import { o1 } from "../g/l";
import { h1 } from "../g/k";
import { b11 } from "./t1/v1";
import { u } from "../g/h";
import { o10 } from "./t1/u1";
export class j2 {
    constructor() {
        this.p10 = new g13();
        this.a10 = new f14();
    }
    static getInstance() {
        if (!j2.instance) {
            j2.instance = new j2();
        }
        return j2.instance;
    }
    w2(j14) {
        let k14 = null;
        if (j14 instanceof o1) {
            k14 = p11.getInstance().l8(j14);
        }
        else if (j14 instanceof h1) {
            k14 = b11.getInstance().l8(j14);
        }
        else if (j14 instanceof u) {
            k14 = o10.getInstance().l8(j14);
        }
        if (!k14) {
            l2.error(`Failed to report data, data is null or undefined.`);
            return;
        }
        this.a10.b10(k14, true, this.q10);
    }
    saveData(data) {
        return this.p10.o9(data);
    }
    c6() {
        this.p10.r9();
    }
    r10(data, status) {
        this.p10.t9(data, status);
    }
    s10(listener) {
        this.q10 = listener;
    }
}
